<?php

/*
Edit Pet (admin_edit_pet.php)
*/

$page_title = "Edit Pet";
$rank_check = 7;
include "../header.inc.php";

$game=$_GET['game'];
$act=$_GET['act'];

print "$openHTML";

if (!$act)
{
	$findEnemies = mysql_query("SELECT * FROM pets2 WHERE game = '$game'");
	while ($getEnemies = mysql_fetch_array($findEnemies))
	{	
		$enemyList .= "<option value=$getEnemies[id]>$getEnemies[name]</option>";
	}
	
ECHO <<<END

<FORM ACTION="admin_edit_pet.php?game=$game&act=edit" METHOD=POST> <CENTER><TABLE BGCOLOR="$tableOutline"
CELLSPACING=1 CELLPADDING=0 WIDTH=520> <TR BGCOLOR="$topAndBottomBG"> <TD COLSPAN=2 HEIGHT=50>
<CENTER><FONT SIZE="+2" COLOR="$topAndBottomText">--Edit Pet--</FONT></CENTER> </TD> </TR>
<TR BGCOLOR="$maincellColor"> <TD WIDTH=128 HEIGHT=40> <P>Edit Pet</P> </TD> <TD
HEIGHT=40> <P><FONT SIZE="-1">&nbsp;<select name=edit_enemy>$enemyList</select></FONT></P> </TD> </TR> <TR> <TD
COLSPAN=2 HEIGHT=30 BGCOLOR="$topAndBottomBG"> <CENTER><FONT SIZE="-1" COLOR="$topAndBottomText"><I><INPUT
TYPE=submit NAME=Submit VALUE="Edit Pet!!"></I></FONT></CENTER> </TD> </TR>
</TABLE> </CENTER> </FORM>

END;

}

if ($act == "edit")
{
$edit_enemy = $_POST['edit_enemy'];

$findEnemy = fetch("SELECT * FROM pets2 WHERE game = '$game' AND id = '$edit_enemy'");
if ($findEnemy[starter] == 1) { $checkedStart = " CHECKED"; }

ECHO <<<END

<P><FORM ACTION="admin_edit_pet.pro.php?game=$game&edit=$edit_enemy" enctype="multipart/form-data" METHOD=POST>
   <CENTER><TABLE BGCOLOR="$tableOutline" CELLSPACING=1 CELLPADDING=0 WIDTH=400>
      <TR BGCOLOR="$topAndBottomBG">
         <TD COLSPAN=2 HEIGHT=50>
            <CENTER><FONT SIZE="+2" COLOR="$topAndBottomText">--Edit Pet--</FONT></CENTER>
         </TD>
      </TR>
      <TR BGCOLOR="$maincellColor">
         <TD WIDTH=128 HEIGHT=40>
            <P>Pet Name</P>
         </TD>
         <TD HEIGHT=40>
            <P><FONT SIZE="-1">&nbsp;<INPUT TYPE=text NAME="add_pet_name" VALUE="$findEnemy[name]" SIZE=30 MAXLENGTH=16></FONT></P>
         </TD>
      </TR>
      <TR BGCOLOR="$middleBG">
         <TD WIDTH=128 HEIGHT=40>
            <P>Pet Image</P>
         </TD>
         <TD HEIGHT=40>
            <P><FONT SIZE="-1">&nbsp;<input type=file name=petImage><br>(only use if your changing the image!)</FONT></P>
         </TD>
      </TR>
      <TR BGCOLOR="$maincellColor">
         <TD WIDTH=128 HEIGHT=40>
            <P>Pet Description:</P>
         </TD>
         <TD HEIGHT=40>
            <P><TEXTAREA NAME=pet_desc ROWS=7 COLS=27 WRAP=virtual>$findEnemy[pet_desc]</TEXTAREA></P>
         </TD>
      </TR>
      <TR BGCOLOR="$middleBG">
         <TD WIDTH=128 HEIGHT=40>
            <P>Food Likes</P>
         </TD>
         <TD HEIGHT=40>
            <P><TEXTAREA NAME=food_likes ROWS=7 COLS=27 WRAP=virtual>$findEnemy[item_likes]</TEXTAREA></P>
         </TD>
      </TR>
      <TR BGCOLOR="$maincellColor">
         <TD WIDTH=128 HEIGHT=40>
            <P>Food Dislikes:</P>
         </TD>
         <TD HEIGHT=40>
            <P><TEXTAREA NAME=food_dislikes ROWS=7 COLS=27 WRAP=virtual>$findEnemy[item_dislikes]</TEXTAREA></P>
         </TD>
      </TR>
      <TR BGCOLOR="$middleBG">
         <TD WIDTH=128 HEIGHT=40>
            <P>Starter Pet?<br><font size=-1>Check this if you want people to be able to start with this pet</font></P>
         </TD>
         <TD HEIGHT=40>
            <P><input type=checkbox name=starter_pet value=1$checkedStart> (checked = yes)</P>
         </TD>
      </TR>
      <TR>
         <TD COLSPAN=2 HEIGHT=30 BGCOLOR="$topAndBottomBG">
            <CENTER><FONT SIZE="-1" COLOR="$topAndBottomText"><I><INPUT TYPE=submit NAME=Submit VALUE="Edit Pet!!"></I></FONT></CENTER>
         </TD>
      </TR>
   </TABLE>
   </CENTER>
</FORM></P>

END;
}

print "$closeHTML";
?>
